import {View, Text, StyleSheet, Image, Button} from 'react-native'
import React, {Component} from 'react'
import {ProductDetailTabCategory} from "../../../../page/primary/productDetail";
import {HUNDRED_PERCENT, screenWidth, default as styles, padding, roundWithSize} from "../../../../style/index";
import moment from "moment";
import {Rating} from 'react-native-elements';
import {inject, observer} from "mobx-react/custom";
import {Store} from "../../../../store";
import {ProductStore} from "../../../../store/modules/main/product";
import {dateFormat, defaultArr, defaultObj, getAssetUrl, getImageSizeRatio} from "../../../../util";
import FastImageCustom from "../../../widget/FastImageCustom";
import FastImage from "react-native-fast-image";
import Evaluation from "./evaluation";
import ProductInfo from "./productInfo";

interface TabProp {
    name: string,
    category: ProductDetailTabCategory
}

interface ProductDetailSectionProps extends Store {
    tab: TabProp
}

interface ProductDetailSectionState {
    imageSize: { width: number, height: number }
}


@inject("product")
@observer
export default class ProductDetailSection extends Component<ProductDetailSectionProps, ProductDetailSectionState> {

    product: ProductStore;

    constructor(props: ProductDetailSectionProps) {
        super(props);
        this.product = this.props.product;
    }

    state = {
        imageSize: defaultObj,
    };


    render() {
        const {tab} = this.props;
        const {category} = tab;
        return (<View style={style.container}>
            {category === ProductDetailTabCategory.detail ? <ProductInfo/> : <Evaluation/>}
        </View>)
    }
}

const style = StyleSheet.create({
    container: {
    }
});

 